import { Component } from "react";


export default function CheckLogin(Com) {
    return class extends Component {
        UNSAFE_componentWillMount() {
            const token = localStorage.getItem('token') 
            if (!token) {
                this.props.error('请先登录')
                this.props.history.push('/login')
            }
        }
        render() {
            return <Com success={this.props.success} error={this.props.error} warning={this.props.warning} info={this.props.info}  />
        }
    }
}